--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-description03-fig03.log
  log type:  text
 opened on:  21 Oct 2012, 15:41:24

. 
. 
. * ********************************************************
. * Fig. 3. Coalition-building dynamics: A typical model run
. * ********************************************************
. 
. * Programme:    cbld-description03-fig03.do
. * Project:              Council coalition building
. * Author:               Frank Haege, Department of Politics and Administration
> , University of Limerick
. * Contact:              frank.haege@ul.ie
. 
. * Description
. *************
. * This do-file generates a graph illustrating the coalition-building dynamics 
. * of a typical model run for a membership size of twenty-five states and 
. * a voting threshold of 72 per cent. The indivdual panels show member states p
> ositions
. * at the beginning of the model run and after each of three negotiation rounds
> .
. * Note that the arrows, indicating changes in positions between two negotiatio
> n
. * rounds, and the numbers, indicating the sequence of those changes, were adde
> d manually
. * in Stata's graph editor.
. 
. 
. * Set up Stata
. version 11

. clear all

. macro drop _all

. set linesize 80

. set more off

. 
. * Load member state position data from typical model run
. insheet using "Experiments\Experiment02\cbld-model-121020-exp02-world.csv", cl
> ear
(9 vars, 100 obs)

. 
. * Drop redundant variables
. drop alternativecoalition alternativecoalitionsize blockingminority winningmaj
> ority who

. 
. 
. * Generate and recode variables for plotting
. ********************************************
. 
. * Rename variables
. rename myfirstcriterionsize mycoalsize

. 
. * Label variables
. label var mycoalsize "Coalition size"

. label var xcor "Issue 1"

. label var ycor "Issue 2"

. label var time "Time" 

. 
. * Identify size of coalitions
. tab mycoalsize if time == 0

  Coalition |
       size |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         25      100.00      100.00
------------+-----------------------------------
      Total |         25      100.00

. tab mycoalsize if time == 1

  Coalition |
       size |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |          3       12.00       12.00
          2 |          4       16.00       28.00
          3 |          6       24.00       52.00
          4 |          4       16.00       68.00
          8 |          8       32.00      100.00
------------+-----------------------------------
      Total |         25      100.00

. tab mycoalsize if time == 2

  Coalition |
       size |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |          1        4.00        4.00
          3 |          3       12.00       16.00
          9 |          9       36.00       52.00
         12 |         12       48.00      100.00
------------+-----------------------------------
      Total |         25      100.00

. tab mycoalsize if time == 3

  Coalition |
       size |      Freq.     Percent        Cum.
------------+-----------------------------------
         12 |         12       48.00       48.00
         13 |         13       52.00      100.00
------------+-----------------------------------
      Total |         25      100.00

. 
. * Generate marker symbol size weights as a function of coalition size   
. local 1 = 1*1.5

. local 2 = 2*1

. local 3 = 3*1

. local 4 = 4*1

. local 8 = 8*1

. local 9 = 9*1

. local 12 = 12*1

. local 13 = 13*1

. 
. 
. * Plot of member state positions after initiation of model
. **********************************************************
. 
. twoway (scatter ycor xcor if time == 0 & mycoalsize == 1, /*
>         */ msymbol(o) msize(*`1') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 0 & mycoalsize > 1, /*
>         */ xlabel(-10 -5:10) ylabel(-10 -5:10) /*
>         */ xscale(range(-10 10)) yscale(range(-10 10)) /*
>         */ msymbol(i) mlabel(mycoalsize) mlabsize(small) /*
>         */ mlabpos(center) mlabcolor(white) mfcolor(gray) /*
>         */ aspectratio(1) legend(off) subtitle("Initial Positions")) /*
>         */ , saving("Data analysis\Graphs\cbld-description03-fig03a.gph", repl
> ace)
(file Data analysis\Graphs\cbld-description03-fig03a.gph saved)

. 
. 
. * Plot of member state positions after first round of position changes
. **********************************************************************
. 
. twoway (scatter ycor xcor if time == 1 & mycoalsize == 1, /*
>         */ msymbol(o) msize(*`1') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 1 & mycoalsize == 3, /*
>         */ msymbol(o) msize(*`3') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 1 & mycoalsize == 4, /*
>         */ msymbol(o) msize(*`4') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 1 & mycoalsize == 8, /*
>         */ msymbol(o) msize(*`8') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 1 & mycoalsize == 2, /*
>         */ msymbol(o) msize(*`2') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 1 & mycoalsize > 1, /*
>         */ xlabel(-10 -5:10) ylabel(-10 -5:10) /*
>         */ xscale(range(-10 10)) yscale(range(-10 10)) /*
>         */ msymbol(i) mlabel(mycoalsize) mlabsize(small) /*
>         */ mlabpos(center) mlabcolor(white) mfcolor(gray) /*
>         */ aspectratio(1) legend(off) subtitle("After Round 1"))        /*
>         */ , saving("Data analysis\Graphs\cbld-description03-fig03b.gph", repl
> ace)      
(file Data analysis\Graphs\cbld-description03-fig03b.gph saved)

. 
. 
. * Plot of member state positions after second round of position changes
. ***********************************************************************
.         
. twoway (scatter ycor xcor if time == 2 & mycoalsize == 3, /*
>         */ msymbol(o) msize(*`3') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 2 & mycoalsize == 9, /*
>         */ msymbol(o) msize(*`9') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 2 & mycoalsize == 12, /*
>         */ msymbol(o) msize(*`12') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 2 & mycoalsize == 1, /*
>         */ msymbol(o) msize(*`1') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 2 & mycoalsize > 1, /*
>         */ xlabel(-10 -5:10) ylabel(-10 -5:10) /*
>         */ xscale(range(-10 10)) yscale(range(-10 10)) ylabel(-10 -5:10) /*
>         */ msymbol(i) mlabel(mycoalsize) mlabsize(small) /*
>         */ mlabpos(center) mlabcolor(white) mfcolor(gray) /*
>         */ aspectratio(1) legend(off) subtitle("After Round 2"))        /*
>         */ , saving("Data analysis\Graphs\cbld-description03-fig03c.gph", repl
> ace)      
(file Data analysis\Graphs\cbld-description03-fig03c.gph saved)

. 
. 
. * Plot of member state positions after third round of position changes
. **********************************************************************
.         
. twoway (scatter ycor xcor if time == 3 & mycoalsize == 12, /*
>         */ msymbol(o) msize(*`12') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 3 & mycoalsize == 13, /*
>         */ msymbol(o) msize(*`13') mcolor(white) mfcolor(gray)) /*
>         */ (scatter ycor xcor if time == 3 & mycoalsize > 1, /*
>         */ xlabel(-10 -5:10) ylabel(-10 -5:10) /*
>         */ xscale(range(-10 10)) yscale(range(-10 10)) /*
>         */ msymbol(i) mlabel(mycoalsize) mlabsize(small) /*
>         */ mlabpos(center) mlabcolor(white) mfcolor(gray) /*
>         */ aspectratio(1) legend(off) subtitle("After Round 3"))  /*
>         */, saving("Data analysis\Graphs\cbld-description03-fig03d.gph", repla
> ce)
(file Data analysis\Graphs\cbld-description03-fig03d.gph saved)

. 
. 
. * Combine plots of member state positions at different point in time into a si
> ngle graph
. ******************************************************************************
> **********
.         
. graph combine /*
>         */ "Data analysis\Graphs\cbld-description03-fig03a.gph" /*
>         */ "Data analysis\Graphs\cbld-description03-fig03b.gph" /*
>         */ "Data analysis\Graphs\cbld-description03-fig03c.gph" /*
>         */ "Data analysis\Graphs\cbld-description03-fig03d.gph" /*
>         */ , xsize(3) ysize(3) imargin(tiny) saving("Data analysis\Graphs\cbld
> -description03-fig03.gph", replace)
(file Data analysis\Graphs\cbld-description03-fig03.gph saved)

.         
.         
. * Exit do-file
. log close
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-description03-fig03.log
  log type:  text
 closed on:  21 Oct 2012, 15:41:34
--------------------------------------------------------------------------------
